<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=588683
-->
<head>
  <title>Test for form attributes 3</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=588683">Mozilla Bug 588683</a>
<p id="display"></p>
<div id="content">
  <form id='f'>
    <input name='e1'>
  </form>
  <form id='f2'>
    <input name='e2'>
    <input id='i3' form='f'
     onfocus="var catched=false;
              try { e1; } catch(e) { catched=true; }
              ok(!catched, 'e1 should be in the scope of i3');
              catched = false;
              try { e2; } catch(e) { catched=true; }
              ok(catched, 'e2 should not be in the scope of i3');
              document.getElementById('i4').focus();"
    >
    <input id='i4' form='f2'
     onfocus="var catched=false;
              try { e2; } catch(e) { catched=true; }
              ok(!catched, 'e2 should be in the scope of i4');
              document.getElementById('i5').focus();"
    >
    <input id='i5'
     onfocus="var catched=false;
              try { e2; } catch(e) { catched=true; }
              ok(!catched, 'e2 should be in the scope of i5');
              document.getElementById('i6').focus();"
    >
  </form>
  <input id='i6' form='f'
   onfocus="var catched=false;
            try { e1; } catch(e) { catched=true; }
            ok(!catched, 'e1 should be in the scope of i6');
            document.getElementById('i7').focus();"
  >
  <input id='i7' form='f2'
   onfocus="var catched=false;
            try { e2; } catch(e) { catched=true; }
            ok(!catched, 'e2 should be in the scope of i7');
            this.blur();
            SimpleTest.finish();"
  >
</div>
<pre id="test">
<script type="application/javascript">

/** Test for form attributes 3 **/

SimpleTest.waitForExplicitFinish();

document.getElementById('i3').focus();

</script>
</pre>
</body>
</html>
